﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using DataAccess;

namespace BusinessLogic
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "ProductWCF" in code, svc and config file together.
    public class ProductWCF : IProductWCF
    {
        //----------------------------Product Catalog-----------------------------

        public IEnumerable<Common.Product> GetAllProducts()
        {
            return new ProductRepository().GetAllProducts();
        }

        public Common.Product GetProductById(int id)
        {
            return new ProductRepository().GetProductByID(id);
        }

        public IEnumerable<Common.User_Ratings> GetProductRatings(int id)
        {
            return new ProductRepository().GetProductRatings(id);
        }

        public IEnumerable<Common.Comment> GetProductComments(int id)
        {
            return new ProductRepository().GetProductComments(id);
        }

        //-------------------------Shopping Cart Methods-----------------------------

        public void AddToCart(Common.ShoppingCart sc)
        {
            new ProductRepository().AddToCart(sc);
        }

        public IEnumerable<Common.ShoppingCart> GetShoppingCartByUsername(string username)
        {
            return new ProductRepository().GetShoppingCartByUsername(username);
        }

        public void DeleteFromCart(Common.ShoppingCart sc)
        {
            new ProductRepository().DeleteFromCart(sc);
        }

        public Common.ShoppingCart GetShoppingCartProduct(int shoppingCartID)
        {
            return new ProductRepository().GetShoppingCartProduct(shoppingCartID);
        }

        //-----------------------Order Methods------------------------------------

        public void AddToOrders(Common.Order order)
        {
            new ProductRepository().AddToOrders(order);
        }

        public void AddToOrderDetails(Common.OrderDetail od)
        {
            new ProductRepository().AddToOrderDetails(od);
        }

        public void UpdateOrderDetail(Common.OrderDetail od)
        {
            new ProductRepository().UpdateOrderDetail(od);
        }

        public IEnumerable<Common.Order> GetOrder(string username)
        {
            return new ProductRepository().GetOrder(username);
        }

        public Common.OrderDetail GetOrderDetail(int orderDetailID)
        {
            return new ProductRepository().GetOrderDetail(orderDetailID);
        }

        public IEnumerable<Common.OrderDetail> GetAllOrdersDetails(Guid orderID)
        {
            return new ProductRepository().GetAllOrdersDetails(orderID);
        }

        //-----------------------Ratings & Comments Methods------------------------------------

        public IEnumerable<Common.Rating> GetRatingList()
        {
            return new ProductRepository().GetRatingList();
        }

        public void AddRating(Common.User_Ratings ur)
        {
            new ProductRepository().AddRating(ur);
        }

        public void AddComment(Common.Comment c)
        {
            new ProductRepository().AddComment(c);
        }
    }
}
